public class LookUpContoller {
public String accountName {get; set;}
    public Id accountId {get; set;}
    public List<Contact> contacts {get;set;}
    
    public String query {get; set;}
    public String Error {get; set;}
    public String Error1 {get; set;}
    public Integer length {get;set;}
    public Boolean render {get; set;}
    public List<Account> accounts {get; set;}
    
    public LookUpContoller(){
    
           //render=false;
           
    }
    
    public PageReference findContacts()
       {
    
       try{
           
        if (null!=accountId)
        {
           contacts=[select id,FirstName, LastName from Contact where AccountId=:accountId];
        }else{
                render=true;
            Error1='Please enter a search string at least 3 characters long.';
        }
        }catch(Exception e){
        }
        
        
        return null;
    }
    
    public PageReference runQuery()
    {
    
        render=false;
        
         
        //List<List<Account>> searchResults=[FIND :query IN ALL FIELDS RETURNING Account (id,Name,Sic)];
         
             length=query.length();
             system.debug('@@@@@@@@@'+length);
        
        if(length>2){
        
                system.debug('********'+length);
                List<List<Account>> searchResults=[FIND :query  RETURNING Account (id,Name,Sic)];
                accounts=searchResults[0];
            
            }
        
        else{
        
            render=true;            
            Error='Please enter a search string at least 3 characters long.';
            system.debug('Error$$$$'+Error);
        }
       
        
        return null;
    }

}